package com.damuzee.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.commons.lang.time.DateUtils;

/**
 * 
 * 
 * @author karka.w
 *
 */
public class DateUtil extends DateUtils{
	
	public static final String FORMAT_DATE = "yyyy-mm-dd" ;
	public static final String FORMAT_DATETIME = "yyyy-mm-dd hh:MM:ss" ;
	public static final String FORMAT_TIME = "hh:MM:ss" ;
	
	public static String getDate(Date date){
		
		 return formatDate(date,FORMAT_DATE) ;
	}
	
	public static String getTime(Date date){
		
		return formatDate(date, FORMAT_TIME);
	}
	
	public static String getDateTime(Date date){
		return formatDate(date, FORMAT_DATETIME);
	}
	
	/**
	 * 获取当前日期
	 * 
	 * @param format
	 * @return
	 */
	public static String getCurrentDateTime(String format){
		Date date = new Date();
		return formatDate(date,format);
	}
	
	private static String formatDate(Date date,String format){
		
		
		SimpleDateFormat sdf = new SimpleDateFormat(format);
		
		return sdf.format(date);
	}
	
}	

